from paddlespeech.cli.asr import ASRExecutor

def asr_normal(audio_file):
    # 初始化 ASR 执行器
    asr = ASRExecutor()

    # 识别音频文件-通罗雷打笑摇看木走类粗血(right:陀螺嘞#1大小#2要看#1木轴嘞#1粗细#4。)
    text = asr(audio_file="input_files/sichuan_dialet/000001.wav")
    print("识别结果:", text)


def asr_dialect(audio_file):
    asr = ASRExecutor()
    text = asr(
        audio_file=audio_file,
        model="conformer_online_multicn",  # 使用支持多种中文方言的模型
        lang="zh",
    )
    print("方法1 (多方言模型) 识别结果:", text)

def asr_dialect_wenetspeech(audio_file):
    """print("\n改进方法:")
    asr_dialect_wenetspeech(audio_file)
    """
    asr = ASRExecutor()
    text = asr(
        audio_file=audio_file,
        model="conformer_wenetspeech",  # 使用WenetSpeech训练的模型
        lang="zh", 
    )
    print("方法2 (WenetSpeech模型) 识别结果:", text)
    
audio_file="input_files/sichuan_dialet/000001.wav"
# 分别使用两种方法尝试识别四川方言
print("\n===== 测试四川话方言识别 =====")
print("原始结果 (默认模型):")
asr_dialect(audio_file)

